Skip to content

Canonicalize free regions from inputs as placeholders in root univ#155487

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
ShoyuVanilla:canon-ph
Apr 29, 2026
Merged

Canonicalize free regions from inputs as placeholders in root univ#155487
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
ShoyuVanilla:canon-ph

Conversation

@ShoyuVanilla
Copy link
Copy Markdown
Member

@ShoyuVanilla ShoyuVanilla commented Apr 18, 2026

View all comments

Context: The box named coroutine witness Send lifetime requirements now considered by leakcheck this roadmap

Fixes (only for the next-solver) #106569
Prerequisite of #155749

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Apr 18, 2026
@ShoyuVanilla
Copy link
Copy Markdown
Member Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Apr 18, 2026
Canonicalize free regions from inputs as placeholders in root univ
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 18, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 18, 2026

☀️ Try build successful (CI)
Build commit: e39d9d1 (e39d9d1e2232da07330c87d8314c3587ec4edb1f, parent: 8da2d28cbd5a4e2b93e028e709afe09541671663)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (e39d9d1): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.2% [0.1%, 0.3%] 4
Improvements ✅
(primary)
-1.1% [-4.4%, -0.2%] 40
Improvements ✅
(secondary)
-1.1% [-3.2%, -0.1%] 33
All ❌✅ (primary) -1.1% [-4.4%, -0.2%] 40

Max RSS (memory usage)

Results (primary 2.8%, secondary 3.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.8% [1.0%, 5.5%] 7
Regressions ❌
(secondary)
3.2% [1.6%, 4.8%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.8% [1.0%, 5.5%] 7

Cycles

Results (primary -3.2%, secondary 0.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.1% [2.1%, 2.1%] 1
Improvements ✅
(primary)
-3.2% [-4.0%, -2.3%] 7
Improvements ✅
(secondary)
-1.6% [-1.6%, -1.6%] 1
All ❌✅ (primary) -3.2% [-4.0%, -2.3%] 7

Binary size

Results (secondary -0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.1%] 4
All ❌✅ (primary) - - 0

Bootstrap: 493.313s -> 494.404s (0.22%)
Artifact size: 394.36 MiB -> 394.31 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 18, 2026
@ShoyuVanilla ShoyuVanilla force-pushed the canon-ph branch 2 times, most recently from 3b462e7 to bfdd538 Compare April 19, 2026 07:50
@ShoyuVanilla
Copy link
Copy Markdown
Member Author

r? lcnr

= note: closure with signature `for<'a> fn(&'a &'2 str) -> bool` must implement `FnOnce<(&&'1 str,)>`, for any lifetime `'1`...
= note: ...but it actually implements `FnOnce<(&&'2 str,)>`, for some specific lifetime `'2`
= note: closure with signature `for<'a> fn(&'a &'0 str) -> bool` must implement `FnOnce<(&&'1 str,)>`, for any two lifetimes `'0` and `'1`...
= note: ...but it actually implements `FnOnce<(&&str,)>`
Copy link
Copy Markdown
Member Author

@ShoyuVanilla ShoyuVanilla Apr 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have lots of those ...but it actually implements X for some specific lifetime '?x -> ...but it actually implements X for some specific lifetime diagnostic drifts due to the canonicalized region being placeholders rather than region vars.
I think this is somewhat regressive. Would it make sense to fix them somehow?

View changes since the review

@ShoyuVanilla
Copy link
Copy Markdown
Member Author

I'm not sure I should do something with diagnostics but marking this as ready 😅

@ShoyuVanilla ShoyuVanilla marked this pull request as ready for review April 27, 2026 04:43
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 27, 2026
Comment on lines +469 to +471
if !(placeholder.universe() == ty::UniverseIndex::ROOT
&& placeholder.bound.kind == ty::BoundRegionKind::Anon)
&& max_input_universe.can_name(placeholder.universe())
Copy link
Copy Markdown
Contributor

@lcnr lcnr Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't just placeholder.universe() != ty::UniverseIndex::ROOT be enough here. We should never add new placeholders to an existing universe and max_input_universe is guaranteed to be able to the root universe, as can_name is equivalent to max_input_universe >= placeholder.universe()

View changes since the review

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't there still be the cases that adding new placeholders to a new_universe > max_input_universe?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, yeah, it's the other way around

  • either the placeholder is in the root universe
  • or from a universe which can't be named by max_input_universe

Copy link
Copy Markdown
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 thoughts here:

It's somewhat scary that this requires literally no changes when we instantiate query responses. I guess what's happening is that this is (another) load bearing use of query_response_instantiation_guess (old solver) and the hack in compute_query_response_instantiation_values (next solver). We should definitely at least update the comments here.

Related to the above, it feels scary to me to change the old solver canonicalization here. I think your change also makes the different CanonicalizeMode be slightly outdated or what not 🤔 could you just limit this to the new solver for now?

CanonicalizeUserTypeAnnotations is interesting to me as that one is more a canonicalize_response where the var_values are just the early/late bound params in the parent function

View changes since this review

@rustbot

This comment has been minimized.

@ShoyuVanilla ShoyuVanilla force-pushed the canon-ph branch 2 times, most recently from da3a195 to 7f82ec1 Compare April 27, 2026 16:05
@ShoyuVanilla
Copy link
Copy Markdown
Member Author

@bors try @rust-timer queue

@rustbot

This comment has been minimized.

@ShoyuVanilla
Copy link
Copy Markdown
Member Author

@bors r=lcnr

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 28, 2026

📌 Commit 926a31b has been approved by lcnr

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 28, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Apr 29, 2026
Canonicalize free regions from inputs as placeholders in root univ



Context: The box named *coroutine witness Send lifetime requirements now considered by leakcheck* [this roadmap](https://raw.githubusercontent.com/hexcatnl/roadmap/e380fef94b47c02a056b4c8f05124a9db475b990/next-solver.svg)

Fixes (only for the next-solver) #106569 
Prerequisite of #155749
@rust-log-analyzer

This comment has been minimized.

@rust-bors rust-bors Bot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 29, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 29, 2026

💔 Test for 976cee2 failed: CI. Failed job:

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 29, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 29, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@ShoyuVanilla
Copy link
Copy Markdown
Member Author

@bors r=lcnr

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 29, 2026

📌 Commit f2ae894 has been approved by lcnr

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 29, 2026
@rust-bors

This comment has been minimized.

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 29, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 29, 2026

☀️ Test successful - CI
Approved by: lcnr
Duration: 3h 40m 1s
Pushing c935696 to main...

@rust-bors rust-bors Bot merged commit c935696 into rust-lang:main Apr 29, 2026
12 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 29, 2026
@github-actions
Copy link
Copy Markdown
Contributor

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 0424cc1 (parent) -> c935696 (this PR)

Test differences

Show 9 test diffs

Stage 1

  • [ui] tests/ui/implied-bounds/normalization-preserve-equality.rs#borrowck: pass -> [missing] (J1)
  • [ui] tests/ui/implied-bounds/normalization-preserve-equality.rs#borrowck_current: [missing] -> pass (J1)
  • [ui] tests/ui/implied-bounds/normalization-preserve-equality.rs#borrowck_next: [missing] -> pass (J1)

Stage 2

  • [ui] tests/ui/implied-bounds/normalization-preserve-equality.rs#borrowck: pass -> [missing] (J0)
  • [ui] tests/ui/implied-bounds/normalization-preserve-equality.rs#borrowck_current: [missing] -> pass (J0)
  • [ui] tests/ui/implied-bounds/normalization-preserve-equality.rs#borrowck_next: [missing] -> pass (J0)

Additionally, 3 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard c935696dd07ca51e6fba2f6579919eea2a50863b --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. dist-aarch64-linux: 1h 47m -> 2h 58m (+66.2%)
  2. dist-x86_64-illumos: 1h 37m -> 2h 39m (+63.7%)
  3. dist-x86_64-llvm-mingw: 1h 29m -> 2h 17m (+54.2%)
  4. dist-ohos-armv7: 1h 8m -> 1h 37m (+43.6%)
  5. dist-ohos-x86_64: 1h 14m -> 1h 47m (+43.3%)
  6. dist-x86_64-freebsd: 1h 24m -> 1h 59m (+41.0%)
  7. dist-ohos-aarch64: 1h 17m -> 1h 48m (+40.1%)
  8. dist-aarch64-llvm-mingw: 1h 39m -> 2h 3m (+24.2%)
  9. dist-x86_64-mingw: 2h 10m -> 2h 37m (+20.8%)
  10. dist-i686-linux: 1h 51m -> 2h 13m (+19.8%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@ShoyuVanilla ShoyuVanilla deleted the canon-ph branch April 29, 2026 17:22
@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (c935696): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.2% [-2.9%, -0.8%] 6
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (secondary 0.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.6% [1.6%, 1.6%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.3% [-1.3%, -1.3%] 1
All ❌✅ (primary) - - 0

Cycles

Results (secondary -0.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.3% [2.3%, 2.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.9% [-2.9%, -2.9%] 1
All ❌✅ (primary) - - 0

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 481.379s -> 487.214s (1.21%)
Artifact size: 390.96 MiB -> 390.94 MiB (-0.01%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants